using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
//mihai
namespace BPMN.MainWindow
{
    public class HotSpot
    {
        PointF PointF;
        ConnectingObject connectingObject = null;

        public HotSpot()
        {
            PointF = new PointF();
        }
        public HotSpot(PointF PointF)
        {
            this.PointF = new PointF(PointF.X, PointF.Y);
        }
        public PointF Location
        {
            set
            {
                PointF = value;
            }
            get
            {
                return PointF;
            }
        }
        public ConnectingObject ConnectingObject
        {
            set
            {
                connectingObject = value;
            }
            get
            {
                return connectingObject;
            }
        }
    }
    public class HotSpots : IEnumerable<HotSpot>
    {
        List<HotSpot> hotspots = new List<HotSpot>();
        public HotSpot this[int index]
        {
            set
            {
                hotspots[index] = value;
            }
            get
            {
                return hotspots[index];
            }
        }
        public HotSpot this[HotSpot hotspot]
        {
            set
            {
                for (int i = 0; i < hotspots.Count; i++)
                {
                    if (hotspots[i] == hotspot)
                    {
                        hotspots[i] = value;
                    }
                }
            }
            get
            {
                for (int i = 0; i < hotspots.Count; i++)
                {
                    if (hotspots[i] == hotspot)
                    {
                        return hotspot;
                    }
                }
                return null;
            }
        }
        public int Count
        {
            get
            {
                return hotspots.Count;
            }
        }

        public void Add(HotSpot item)
        {
            hotspots.Add(item);
        }

        public void Clear()
        {
            hotspots.Clear();
        }

        public int GetIndex(HotSpot name)
        {
            for (int i = 0; i < hotspots.Count; i++)
            {
                if (hotspots[i] == name)
                {
                    return i;
                }
            }
            return -1;
        }

        #region IEnumerable<HotSpot> Members

        public IEnumerator<HotSpot> GetEnumerator()
        {
            return hotspots.GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return hotspots.GetEnumerator();
        }

        #endregion
    }
}
